home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 365_01 / config.h < prev    next >
C/C++ Source or Header  |  1992-04-04  |  13KB  |  528 lines

  1. /*
  2.  * vi configuration file
  3.  * We try to automatically configure to various compilers and operating
  4.  * systems. Extend the autoconf section as needed.
  5.  */
  6.  
  7. #ifndef _CONFIG_H
  8. # define _CONFIG_H
  9.  
  10. /*************************** autoconf section ************************/
  11.  
  12. /* Commodore-Amiga */
  13. #ifdef    amiga
  14. # define AMIGA        1
  15. # define COMPILED_BY    "Manx Aztec C 5.2b"
  16. #endif
  17.  
  18. /* standard unix V (?) */
  19. #ifdef    M_SYSV
  20. # define UNIXV        1
  21. #endif
  22.  
  23. /* xelos system, University of Ulm */
  24. #ifdef    xelos
  25. # define UNIXV        1
  26. #endif
  27.  
  28. /* BSD UNIX? */
  29. #ifdef bsd
  30. # define BSD        1
  31. #else
  32. # ifdef sun
  33. #  define BSD        1
  34. # endif
  35. #endif
  36.  
  37. /* Microsoft C: sorry, Watcom does the same thing */
  38. #ifdef    M_I86
  39. # ifndef M_SYSV
  40. #  define MSDOS        1
  41. #  ifdef IBMC2
  42. #   define COMPILED_BY    "IBM C/2 1.00"
  43. #  else
  44. #   define MICROSOFT    1
  45. #   define COMPILED_BY    "Microsoft C 5.10"
  46. #  endif
  47. # endif
  48. #endif
  49.  
  50. /* Borland's Turbo C */
  51. #ifdef    __TURBOC__
  52. # define MSDOS        1
  53. # define TURBOC        1
  54. # ifdef __BORLANDC__
  55. # define COMPILED_BY    "Borland C 2.00"
  56. # else
  57. # define COMPILED_BY    (__TURBOC__ >= 661 ? "Turbo C++ 1.00" : "Turbo C 2.00")
  58. # endif
  59. #endif
  60.  
  61. /* Tos Mark-Williams */
  62. #ifdef    M68000
  63. # define TOS 1
  64. # define COMPILED_BY    "Mark Williams C"
  65. #endif
  66.  
  67. /* Tos GNU-C */
  68. #if defined(__atarist__) && defined(__gem__)
  69. # define TOS 1
  70. # define COMPILED_BY    "GNU-C " __VERSION__
  71. #endif
  72.  
  73. /* OS9/68000 */
  74. #ifdef    OSK
  75. # define COMPILED_BY    "Microware C V2.3 Edition 40"
  76. #endif
  77.  
  78. /* DEC Rainbow, running MS-DOS (handled by earlier MS-DOS tests) */
  79. /* (would need -DRAINBOW in CFLAGS to compile a Rainbow-compatible .EXE) */
  80.  
  81. #ifdef VMS
  82. # define COMPILED_BY    "VAX/VMS VAXC compiler"
  83. # undef VMS
  84. # define VMS 1
  85. #endif
  86.  
  87. /*************************** end of autoconf section ************************/
  88.  
  89. /* All undefined symbols are defined to zero here, to allow for older    */
  90. /* compilers which dont understand #if defined() or #if UNDEFINED_SYMBOL */
  91.  
  92. /*************************** operating systems *****************************/
  93.  
  94. #ifndef    BSD
  95. # define BSD    0        /* UNIX - Berkeley 4.x */
  96. #endif
  97.  
  98. #ifndef    UNIXV
  99. # define UNIXV    0        /* UNIX - AT&T SYSV */
  100. #endif
  101.  
  102. #ifndef    UNIX7
  103. # define UNIX7    0        /* UNIX - version 7 */
  104. #endif
  105.  
  106. #ifndef    MSDOS
  107. # define MSDOS    0        /* PC        */
  108. #endif
  109.  
  110. #ifndef    TOS
  111. # define TOS    0        /* Atari ST    */
  112. #endif
  113.  
  114. #ifndef    AMIGA
  115. # define AMIGA    0        /* Commodore Amiga */
  116. #endif
  117.  
  118. #ifndef OSK
  119. # define OSK    0        /* OS-9 / 68k */
  120. #endif
  121.  
  122. #ifndef COHERENT
  123. # define COHERENT 0        /* Coherent */
  124. #endif
  125.  
  126. #ifndef RAINBOW            /* DEC Rainbow support, under MS-DOS */
  127. # define RAINBOW 0
  128. #endif
  129.  
  130. #ifndef VMS
  131. # define VMS 0                  /* VAX/VMS */
  132. #endif
  133.                 /* Minix has no predefines */
  134. #if !BSD && !UNIXV && !UNIX7 && !MSDOS && !TOS && !AMIGA && !OSK && !COHERENT && !VMS
  135. # define MINIX    1
  136. #else
  137. # define MINIX    0
  138. #endif
  139.  
  140.                 /* generic combination of Unices */
  141. #if UNIXV || UNIX7 || BSD || MINIX || COHERENT
  142. # define ANY_UNIX 1
  143. #else
  144. # define ANY_UNIX 0
  145. #endif
  146.  
  147. /*************************** compilers **************************************/
  148.  
  149. #ifndef    AZTEC_C
  150. # define AZTEC_C    0
  151. #endif
  152.  
  153. #ifndef    MICROSOFT
  154. # define MICROSOFT    0
  155. #endif
  156.  
  157. #ifndef    TURBOC
  158. # define TURBOC        0
  159. #endif
  160.  
  161. /******************************* Credit ************************************/
  162.  
  163. #if MSDOS
  164. # define CREDIT "Ported to MS-DOS by Guntram Blohm & Martin Patzel"
  165. # if RAINBOW
  166. #  define CREDIT2 "Rainbow support added by Willett Kempton"
  167. # endif
  168. #endif
  169.  
  170. #if AMIGA
  171. # define CREDIT "Ported to AmigaDOS 2.04 by Mike Rieser & Dale Rahn"
  172. #endif
  173.  
  174. #if TOS
  175. # define CREDIT "Ported to Atari/TOS by Guntram Blohm & Martin Patzel"
  176. #endif
  177.  
  178. #if OSK
  179. # define CREDIT    "Ported to Microware OS9/68k by Peter Reinig"
  180. #endif
  181.  
  182. #if COHERENT
  183. # define CREDIT    "Ported to Coherent by Esa Ahola"
  184. #endif
  185.  
  186. #if VMS
  187. # define CREDIT "Ported to VAX/VMS by John Campbell"
  188. #endif
  189. /*************************** functions depending on OS *********************/
  190.  
  191. /* There are two terminal-related functions that we need: ttyread() and
  192.  * ttywrite().  The ttyread() function implements read-with-timeout and is
  193.  * a true function on all systems.  The ttywrite() function is almost always
  194.  * just a macro...
  195.  */
  196. #if !TOS && !AMIGA
  197. # define ttywrite(buf, len)    write(1, buf, (unsigned)(len))    /* raw write */
  198. #endif
  199.  
  200. /* The strchr() function is an official standard now, so everybody has it
  201.  * except Unix version 7 (which is old) and BSD Unix (which is academic).
  202.  * Those guys use something called index() to do the same thing.
  203.  */
  204. #if BSD || UNIX7 || OSK
  205. # define strchr    index
  206. #endif
  207. extern char *strchr();
  208.  
  209. /* BSD uses bcopy() instead of memcpy() */
  210. #if BSD
  211. # define memcpy(dest, src, siz)    bcopy(src, dest, siz)
  212. #endif
  213.  
  214. /* BSD uses getwd() instead of getcwd().  The arguments are a little different,
  215.  * but we'll ignore that and hope for the best; adding arguments to the macro
  216.  * would mess up an "extern" declaration of the function.
  217.  */
  218. #if BSD || COHERENT
  219. # define getcwd    getwd
  220. #endif
  221. extern char *getcwd();
  222.  
  223. /* text versa binary mode for read/write */
  224. #if !TOS
  225. #define    tread(fd,buf,n)        read(fd,buf,(unsigned)(n))
  226. #define twrite(fd,buf,n)    write(fd,buf,(unsigned)(n))
  227. #endif
  228.  
  229. /**************************** Compiler quirks *********************************/
  230.  
  231. /* the UNIX version 7 and (some) TOS compilers, don't allow "void" */
  232. #if UNIX7 || TOS
  233. # define void int
  234. #endif
  235.  
  236. /* as far as I know, all compilers except version 7 support unsigned char */
  237. /* NEWFLASH: the Minix-ST compiler has subtle problems with unsigned char */
  238. #if UNIX7 || MINIX
  239. # define UCHAR(c)    ((c) & 0xff)
  240. # define uchar        char
  241. #else
  242. # define UCHAR(c)    ((unsigned char)(c))
  243. # define uchar        unsigned char
  244. #endif
  245.  
  246. /* Some compilers prefer to have malloc declared as returning a (void *) */
  247. #if BSD || AMIGA
  248. extern void *malloc();
  249. #else
  250. extern char *malloc();
  251. #endif
  252.  
  253. /* everybody but Amiga wants lseek declared here */
  254. #if !AMIGA
  255. extern long lseek();
  256. #endif
  257.  
  258. /******************* Names of files and environment vars **********************/
  259.  
  260. #if ANY_UNIX
  261. # ifndef TMPDIR
  262. #  if MINIX
  263. #   define TMPDIR    "/usr/tmp"    /* Keep elvis' temp files off RAM disk! */
  264. #  else
  265. #   define TMPDIR    "/tmp"        /* directory where temp files live */
  266. #  endif
  267. # endif
  268. # ifndef PRSVDIR
  269. #  define PRSVDIR    "/usr/preserve"    /* directory where preserved file live */
  270. # endif
  271. # ifndef PRSVINDEX
  272. #  define PRSVINDEX    "/usr/preserve/Index" /* index of files in PRSVDIR */
  273. # endif
  274. # ifndef EXRC
  275. #  define EXRC        ".exrc"        /* init file in current directory */
  276. # endif
  277. # define SCRATCHOUT    "%s/soXXXXXX"    /* temp file used as input to filter */
  278. # ifndef SHELL
  279. #  define SHELL        "/bin/sh"    /* default shell */
  280. # endif
  281. # if COHERENT
  282. #  ifndef REDIRECT
  283. #   define REDIRECT    ">"        /* Coherent CC writes errors to stdout */
  284. #  endif
  285. # endif
  286. #endif
  287.  
  288. #if AMIGA        /* Specify AMIGA environment */
  289. # ifndef CC_COMMAND
  290. #  define CC_COMMAND    "cc"        /* generic C compiler */
  291. # endif
  292. # ifndef COLON
  293. #  define COLON        ':'        /* Amiga files can also end in `:' */
  294. # endif
  295. # ifndef SYSEXRC
  296. #  define SYSEXRC    "S:" EXRC    /* name of ".exrc" file in system dir */
  297. # endif
  298. # ifndef MAXRCLEN
  299. #  define MAXRCLEN    2048        /* max size of a .exrc file */
  300. # endif
  301. # ifndef NBUFS
  302. #  define NBUFS        10        /* must be at least 3 -- more is better */
  303. # endif
  304. # ifndef NEEDSYNC
  305. #  define NEEDSYNC    TRUE        /* assume ":se sync" by default */
  306. # endif
  307. # ifndef PRSVDIR
  308. #  define PRSVDIR    "Elvis:"    /* directory where preserved file live */
  309. # endif
  310. # ifndef PRSVINDEX
  311. #  define PRSVINDEX    "Elvis:Index"    /* index of files in PRSVDIR */
  312. # endif
  313. # ifndef REDIRECT
  314. #  define REDIRECT    ">"        /* Amiga writes errors to stdout */
  315. # endif
  316. # ifndef SCRATCHIN
  317. #  define SCRATCHIN    "%sSIXXXXXX"
  318. # endif
  319. # ifndef SCRATCHOUT
  320. #  define SCRATCHOUT    "%sSOXXXXXX"
  321. # endif
  322. # ifndef SHELL
  323. #  define SHELL        "newshell"    /* default shell */
  324. # endif
  325. # ifndef TERMTYPE
  326. #  define TERMTYPE    "amiga"        /* default termtype */
  327. # endif
  328. # ifndef TMPDIR                /* for AMIGA should end in `:' or `/' */
  329. #  define TMPDIR    "T:"        /* directory where temp files live */
  330. # endif
  331. # ifndef TMPNAME
  332. #